## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
##
## JZoC by Jeckel.
##

from CvPythonExtensions import *

import Popup as PyPopup
import CvUtil
import CvEventManager

import CvConfigParser
import CvPath

import CvJZoCGameUtils



gc = CyGlobalContext()

jz = CvJZoCGameUtils.JZoC()
# globals
#########################################################################
class CvJZoCEventManager:
	def __init__(self, eventManager):

		global g_bJZoCFeaturesEnabled
		g_bJZoCFeaturesEnabled = False

		# Load the ViSa Component Control Ini
		config = CvConfigParser.CvConfigParser("ViSa-Component-Control.ini")

		# If the ViSa Component Control Ini file was found then load its values
		if(config != None):
			g_bJZoCFeaturesEnabled = config.getboolean("ViSa Component Control", "JZoC Features allowed", False)

		# initialize base class
		eventManager.addEventHandler("unitMove", self.onUnitMove)
		eventManager.addEventHandler("improvementBuilt", self.onImprovementBuilt)

	def onUnitMove(self, argsList):

		if (g_bJZoCFeaturesEnabled):
			jz.doUnitMove(argsList)
		
	def onImprovementBuilt(self, argsList):

		if (g_bJZoCFeaturesEnabled):
			jz.doImprovementBuilt(argsList)

